<template>
    <wv-tabbar class="tabbar_footer">

        
        <wv-tabbar-item  :to="type==3 ? '/index?type=3' :'/index?type=4'"  v-bind:class="currentPage=='/index'?'is-on':''" >
            <img class="weui-tabbar__icon" :src="page" slot="icon">
            首页
        </wv-tabbar-item>
        <wv-tabbar-item v-if="type==3" :to="type==3 ? '/storehouse?type=3' :'/storehouse?type=4'" v-bind:class="currentPage=='/storehouse'?'is-on':''" >
            <img class="weui-tabbar__icon" :src="moneyPage" slot="icon">
            云仓库
        </wv-tabbar-item>
        <wv-tabbar-item  :to="type==3 ? '/order?type=3' :'/order?type=4'" v-bind:class="currentPage=='/order'?'is-on':''" >
            <img class="weui-tabbar__icon" :src="moneyPage" slot="icon">
            订单 
        </wv-tabbar-item>
        <wv-tabbar-item :to="type==3 ? '/myhome?type=3' :'/myhome?type=4'" class="tabbar_name" v-bind:class="currentPage=='/myhome'?'is-on':''">
            <img class="weui-tabbar__icon" :src="url" slot="icon"> 我的
        </wv-tabbar-item>

       
    </wv-tabbar>
</template>

<script>
import homepic from "../../static/img/home.png"
import homepic1 from "../../static/img/home1.png"
import mypic from "../../static/img/my.png"
import mypic1 from "../../static/img/my1.png"
import money from "../../static/img/money.png"
import money1 from "../../static/img/money1.png"


export default {
  name: "tabbar",
  props: {
    type: Number
  },
  data(){
      return{
          page:"",
          url:"",
          moneyPage:"",
          currentPage:"",
          types:this.type,

      }
  },
  methods: {
    onClick () {
      console.log('click')
    }
  },
  created() {
      this.page = (this.$route.path == '/index' ? homepic : homepic1);
      this.url = (this.$route.path == '/myhome' ? mypic : mypic1);
      this.moneyPage = (this.$route.path == '/moneybag' ? money : money1);
      this.currentPage = this.$route.path;
      console.log(this.types+"===-----")
  }, 
 
  
};
</script>


<style lang="scss">
@import '../base/reset.scss';
@import "../base/common.scss";

.tabbar_footer {
    position:fixed !important;
    .weui-tabbar__icon {
        width:pxTorem(40);
        height:pxTorem(40)
    }
    

    .is-on {
        .weui-tabbar__label {
          color:#2aa515; 
          font-size: pxTorem(28);
        }
    }
    .weui-tabbar__label {
        color:#505050;
        font-size: pxTorem(28);
    }
    
}


</style>